<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:t="http://java.sun.com/jsf/composite/components/toolbar"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
	<link rel="stylesheet"
		href="#{request.contextPath}/resources/css/principal.css"
		type="text/css" />
</h:head>
<body>

	<h:form id="frmPrincipal">

		<t:toolbar managedbean="#{clienteForm}" widgetVar="toolBar" />

		<br />

		<p:fieldset legend="Gestão Produtos">

			<div class="ui-widget-aling-left">
				<div>
					<h:outputLabel styleClass="ui-widget-label" value="Código" />
				</div>
				<div>
					<p:inputText value="#{clienteForm.entidade.id}" disabled="true"
						size="5" />
				</div>
			</div>
			
			<div class="ui-widget-aling-left">
				<div>
					<h:outputLabel styleClass="ui-widget-label"
						value="Nome do cliente" />
				</div>
				<div>
					<p:inputText value="#{clienteForm.entidade.nome}"
						disabled="#{!clienteForm.estadoCadastrando and !clienteForm.estadoEditando}"
						size="80" maxlength="120" />
				</div>
			</div>
			
			<div class="ui-widget-aling-left">
				<div>
					<h:outputLabel styleClass="ui-widget-label"
						value="CPF" />
				</div>
				<div>
					<p:inputText value="#{clienteForm.entidade.cpf}"
						disabled="#{!clienteForm.estadoCadastrando and !clienteForm.estadoEditando}"
						size="80" maxlength="120" />
				</div>
			</div>

		</p:fieldset>

	</h:form>
	
	<!-- MODAL DE PESQUISA -->
	
	<p:dialog id="dglPesquisa" widgetVar="lovPesquisa"
		header="Pesquisar Cliente">
		<h:form id="frmLovPesquisa">
			<p:dataTable value="#{clienteForm.todos}"
				selection="#{clienteForm.entidade}" selectionMode="single"
				var="grupo" dblClickSelect="true"
				rowSelectListener="#{clienteForm.selecionar}"
				onRowSelectComplete="lovPesquisa.hide()" update="frmPrincipal">

				<p:column headerText="Nome" filterBy="#{grupo.id}">
					<h:outputText value="#{grupo.id}" />
				</p:column>
				<p:column headerText="CPF" filterBy="#{grupo.nome}">
					<h:outputText value="#{grupo.nome}" />
				</p:column>
			</p:dataTable>
		</h:form>
	</p:dialog>


</body>
</html>
